﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;

namespace RTracker.Models.User
{
    public class CUser
    {
        int m_nUserId;
        int m_nOrganizationId;
        String m_strFirstName;
        String m_strLastName;
        DateTime? m_dtDOB;
        String m_strGender;
        String m_strTitle;
        DateTime? m_dtActivationDate;
        DateTime? m_dtExpirationDate;
        String m_strLogonName;
        String m_strLogonPassword;
        String m_strOldLogonPassword;
        String m_strEmailAddress;
        int m_nLogonStatus;
        DateTime? m_dtPasswordChangeTimestamp;
        int m_nUserAccountStatus;
        int m_nLogonLocked;
        DateTime? m_dtLogonLockedTimestamp;
        Boolean m_bChangePasswordNextLogon;
        DateTime? m_dtLastSuccessfulLogonTimestamp;
        DateTime? m_dtLastSuccessfulLogoutTimestamp;
        int m_nLogonFailureCount;
        Boolean m_bIsSystemGenerated;
        Boolean m_bIsSoftLocked;
        int m_nSoftLockedBy;
        DateTime? m_dtSoftLockTimestamp;
        Boolean m_bIsHardLocked;
        int m_nHardLockedBy;
        DateTime? m_dtHardLockTimestamp;
        DateTime? m_dtCreateTimestamp;
        int m_nCreatedBy;
        DateTime? m_dtModifiedTimestamp;
        int m_nModifiedBy;
        Boolean m_bDeleteFlag;
        int m_nPageNumber;
        int m_nRowSize;
        String m_strSortOn;
        String m_strSortType;
        String m_strSearch;
        String m_strSearchOn;
        Boolean m_bCondition;
        String m_strUserIds;
        int m_nPasswordChangePurpose;
        string m_strSoftlockedByName;
        string m_strHardlockedByName;
        string m_strCreatedByName;
        string m_strModifiedByName;
        /// <summary>
        /// Constructor of the class.
        /// </summary> 
        /// <date_created>10-04-2014</date_created>
        public CUser()
        {
            m_nUserId = 0;
            m_nOrganizationId = 0;
            m_strFirstName = "";
            m_strLastName = "";
            m_dtDOB = null;
            m_strGender = "";
            m_strTitle = "";
            m_dtActivationDate = null;
            m_dtExpirationDate = null;
            m_strLogonName = "";
            m_strLogonPassword = "";
            m_strOldLogonPassword = "";
            m_strEmailAddress = "";
            m_nLogonStatus = 0;
            m_dtPasswordChangeTimestamp = null;
            m_nUserAccountStatus = 0;
            m_nLogonLocked = 0;
            m_dtLogonLockedTimestamp = null;
            m_bChangePasswordNextLogon = false;
            m_dtLastSuccessfulLogonTimestamp = null;
            m_dtLastSuccessfulLogoutTimestamp = null;
            m_nLogonFailureCount = 0;
            m_bIsSystemGenerated = false;
            m_bIsSoftLocked = false;
            m_nSoftLockedBy = 0;
            m_dtSoftLockTimestamp = null;
            m_bIsHardLocked = false;
            m_nHardLockedBy = 0;
            m_dtHardLockTimestamp = null;
            m_dtCreateTimestamp = null;
            m_nCreatedBy = 0;
            m_dtModifiedTimestamp = null;
            m_nModifiedBy = 0;
            m_bDeleteFlag = false;
            m_nPageNumber = 0;
            m_nRowSize = 0;
            m_strSortOn = "";
            m_strSortType = "";
            m_strSearch = "";
            m_strSearchOn = "";
            m_bCondition = false;
            m_strUserIds = "";
            m_nPasswordChangePurpose = 0;
            m_strHardlockedByName = "";
            m_strSoftlockedByName = "";
            m_strCreatedByName = "";
            m_strModifiedByName = "";
        }

        /// <summary>
        /// Constructor of the class.
        /// </summary> 
        /// <date_created>10-04-2014</date_created>
        public CUser(int nUserId, int nOrganizationId, String strFirstName, String strLastName, DateTime? dtDOB
            , String strGender, String strTitle, DateTime? dtActivationDate, DateTime? dtExpirationDate, String strLogonName
            , String strLogonPassword, String strOldLogonPassword, String strEmailAddress, int nLogonStatus, DateTime? dtPasswordChangeTimestamp, int nUserAccountStatus
            , int nLogonLocked, DateTime? dtLogonLockedTimestamp, Boolean bChangePasswordNextLogon, DateTime? dtLastSuccessfulLogonTimestamp, DateTime? dtLastSuccessfulLogoutTimestamp
            , int nLogonFailureCount, Boolean bIsSystemGenerated, Boolean bIsSoftLocked, int nSoftLockedBy, DateTime? dtSoftLockTimestamp
            , Boolean bIsHardLocked, int nHardLockedBy, DateTime? dtHardLockTimestamp, DateTime? dtCreateTimestamp, int nCreatedBy
            , DateTime? dtModifiedTimestamp, int nModifiedBy, Boolean bDeleteFlag, int nPageNumber, int nRowSize
            , String strSortOn, String strSortType, String strSearch, String strSearchOn, Boolean bCondition, String strUserIds, int nPasswordChangePurpose, string strSoftlockedByName, string strHardlockedByName, string strCreatedByName, string strModifiedByName)
        {
            m_nUserId = nUserId;
            m_nOrganizationId = nOrganizationId;
            m_strFirstName = strFirstName;
            m_strLastName = strLastName;
            m_dtDOB = dtDOB;
            m_strGender = strGender;
            m_strTitle = strTitle;
            m_dtActivationDate = dtActivationDate;
            m_dtExpirationDate = dtExpirationDate;
            m_strLogonName = strLogonName;
            m_strLogonPassword = strLogonPassword;
            m_strOldLogonPassword = strOldLogonPassword;
            m_strEmailAddress = strEmailAddress;
            m_nLogonStatus = nLogonStatus;
            m_dtPasswordChangeTimestamp = dtPasswordChangeTimestamp;
            m_nUserAccountStatus = nUserAccountStatus;
            m_nLogonLocked = nLogonLocked;
            m_dtLogonLockedTimestamp = dtLogonLockedTimestamp;
            m_bChangePasswordNextLogon = bChangePasswordNextLogon;
            m_dtLastSuccessfulLogonTimestamp = dtLastSuccessfulLogonTimestamp;
            m_dtLastSuccessfulLogoutTimestamp = dtLastSuccessfulLogoutTimestamp;
            m_nLogonFailureCount = nLogonFailureCount;
            m_bIsSystemGenerated = bIsSystemGenerated;
            m_bIsSoftLocked = bIsSoftLocked;
            m_nSoftLockedBy = nSoftLockedBy;
            m_dtSoftLockTimestamp = dtSoftLockTimestamp;
            m_bIsHardLocked = bIsHardLocked;
            m_nHardLockedBy = nHardLockedBy;
            m_dtHardLockTimestamp = dtHardLockTimestamp;
            m_dtCreateTimestamp = dtCreateTimestamp;
            m_nCreatedBy = nCreatedBy;
            m_dtModifiedTimestamp = dtModifiedTimestamp;
            m_nModifiedBy = nModifiedBy;
            m_bDeleteFlag = bDeleteFlag;
            m_nPageNumber = nPageNumber;
            m_nRowSize = nRowSize;
            m_strSortOn = strSortOn;
            m_strSortType = strSortType;
            m_strSearch = strSearch;
            m_strSearchOn = strSearchOn;
            m_bCondition = bCondition;
            m_strUserIds = strUserIds;
            m_nPasswordChangePurpose = nPasswordChangePurpose;
            m_strSoftlockedByName = strSoftlockedByName;
            m_strHardlockedByName = strHardlockedByName;
            m_strCreatedByName = strCreatedByName;
            m_strModifiedByName = strModifiedByName;
        }

        /// <summary>
        /// Used to store UserId
        /// </summary>

        public int UserId
        {
            get { return m_nUserId; }
            set { m_nUserId = value; }
        }
        /// <summary>
        /// Used to store OrganizationId
        /// </summary>
        public int OrganizationId
        {
            get { return m_nOrganizationId; }
            set { m_nOrganizationId = value; }
        }
   
        /// <summary>
        /// Used to store FirstName
        /// </summary>
        // Validation to check whether field contains any entry or not
        [Required(ErrorMessage = "*FirstName is Required")]
        // Validation to check whether field contains any special characters or not
        [RegularExpression(@"^[0-9a-zA-Z\ ]+$", ErrorMessage = "*No special characters allowed")]
        //validation to check the minimum and maximum string length 
        [StringLength(49, MinimumLength = 1, ErrorMessage = "maximum 49 characters")]
        // Display name of this property
        [DisplayName("First Name")]
        public String FirstName
        {
            get { return m_strFirstName; }
            set { m_strFirstName = value; }
        }
        /// <summary>
        /// Used to store LastName
        /// </summary>
        // Validation to check whether field contains any special characters or not
        [RegularExpression(@"^[0-9a-zA-Z\ ]+$", ErrorMessage = "*No special characters allowed")]
        //validation to check the minimum and maximum string length 
        [StringLength(49, MinimumLength = 1, ErrorMessage = "maximum 49 characters")]
        // Display name of this property
        [DisplayName("Last Name")]
        public String LastName
        {
            get { return m_strLastName; }
            set { m_strLastName = value; }
        }
        /// <summary>
        /// Used to store Date Of Birth of the user
        /// </summary>
        // Display name of this property
        [DisplayName("Date Of Birth")]
        public DateTime? DOB
        {
            get { return m_dtDOB; }
            set { m_dtDOB = value; }
        }
        /// <summary>
        /// Used to store Gender
        /// </summary>
        //validation to check the minimum and maximum string length 
        [StringLength(19, MinimumLength = 0, ErrorMessage = "maximum 19 characters")]
        public String Gender
        {
            get { return m_strGender; }
            set { m_strGender = value; }
        }
        /// <summary>
        /// Used to store Title
        /// </summary>

        public String Title
        {
            get { return m_strTitle; }
            set { m_strTitle = value; }
        }
        /// <summary>
        /// Used to store ActivationDate
        /// </summary>
        // Display name of this property
        [DisplayName("A/C Activate On")]
        public DateTime? ActivationDate
        {
            get { return m_dtActivationDate; }
            set { m_dtActivationDate = value; }
        }
        /// <summary>
        /// Used to store ExpirationDate
        /// </summary>
        // Display name of this property
        [DisplayName("Expire On")]
        public DateTime? ExpirationDate
        {
            get { return m_dtExpirationDate; }
            set { m_dtExpirationDate = value; }
        }
        /// <summary>
        /// Used to store LogonName
        /// </summary>
        // Validation to check whether field contains any entry or not
        [Required(ErrorMessage = "*LogonName is Required")]
        //validation to check the minimum and maximum string length 
        [StringLength(49, MinimumLength = 1, ErrorMessage = "maximum 49 characters")]
        // Validation to check whether field contains any special characters or not
        [RegularExpression(@"^[0-9a-zA-Z_]+$", ErrorMessage = "*No special characters allowed")]
        // Display name of this property
        [DisplayName("User Name")]
        public String LogonName
        {
            get { return m_strLogonName; }
            set { m_strLogonName = value; }
        }
        /// <summary>
        /// Used to store LogonPassword
        /// </summary>
        // Validation to check whether field contains any entry or not
        [Required(ErrorMessage = "*LogonPassword is Required")]
        //validation to check the minimum and maximum string length 
        [StringLength(49, MinimumLength = 1, ErrorMessage = "maximum 49 characters")]
        public String LogonPassword
        {
            get { return m_strLogonPassword; }
            set { m_strLogonPassword = value; }
        }
        /// <summary>
        /// Used to store OldLogonPassword
        /// </summary>
        public String OldLogonPassword
        {
            get { return m_strOldLogonPassword; }
            set { m_strOldLogonPassword = value; }
        }
        /// <summary>
        /// Used to store EmailAddress
        /// </summary>
        // Validation to check whether email is valid
        [RegularExpression(@"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}" +
                           @"\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\" +
                           @".)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$",
                           ErrorMessage = "Email is not valid")]
        //validation to check the minimum and maximum string length 
        [StringLength(250, MinimumLength = 1, ErrorMessage = "maximum 250 characters")]
        public String EmailAddress
        {
            get { return m_strEmailAddress; }
            set { m_strEmailAddress = value; }
        }
        /// <summary>
        /// Used to store LogonStatus
        /// </summary>
        // Display name of this property
        [DisplayName("Is the user currently logged on")]
        public int LogonStatus
        {
            get { return m_nLogonStatus; }
            set { m_nLogonStatus = value; }
        }
        /// <summary>
        /// Used to store PasswordChangeTimestamp
        /// </summary>
        // Display name of this property
        [DisplayName("Last Changed On")]
        public DateTime? PasswordChangeTimestamp
        {
            get { return m_dtPasswordChangeTimestamp; }
            set { m_dtPasswordChangeTimestamp = value; }
        }
        /// <summary>
        /// Used to store UserAccountStatus
        /// </summary>
        // Display name of this property
        [DisplayName("Account status")]
        public int UserAccountStatus
        {
            get { return m_nUserAccountStatus; }
            set { m_nUserAccountStatus = value; }
        }
        /// <summary>
        /// Used to store LogonLocked
        /// </summary>
        // Display name of this property
        [DisplayName("A/C block")]
        public int LogonLocked
        {
            get { return m_nLogonLocked; }
            set { m_nLogonLocked = value; }
        }
        /// <summary>
        /// Used to store LogonLockedTimestamp
        /// </summary>
        // Display name of this property
        [DisplayName("Last blocked On")]
        public DateTime? LogonLockedTimestamp
        {
            get { return m_dtLogonLockedTimestamp; }
            set { m_dtLogonLockedTimestamp = value; }
        }
        /// <summary>
        /// Used to store ChangePasswordNextLogon
        /// </summary>
        // Display name of this property
        [DisplayName("Change pasword")]
        public Boolean ChangePasswordNextLogon
        {
            get { return m_bChangePasswordNextLogon; }
            set { m_bChangePasswordNextLogon = value; }
        }
        /// <summary>
        /// Used to store LastSuccessfulLogonTimestamp
        /// </summary>
        public DateTime? LastSuccessfulLogonTimestamp
        {
            get { return m_dtLastSuccessfulLogonTimestamp; }
            set { m_dtLastSuccessfulLogonTimestamp = value; }
        }
        /// <summary>
        /// Used to store LastSuccessfulLogoutTimestamp
        /// </summary>
        public DateTime? LastSuccessfulLogoutTimestamp
        {
            get { return m_dtLastSuccessfulLogoutTimestamp; }
            set { m_dtLastSuccessfulLogoutTimestamp = value; }
        }
        /// <summary>
        /// Used to store LogonFailureCount
        /// </summary>
        public int LogonFailureCount
        {
            get { return m_nLogonFailureCount; }
            set { m_nLogonFailureCount = value; }
        }
        /// <summary>
        /// Used to store IsSystemGenerated
        /// </summary>
        public Boolean IsSystemGenerated
        {
            get { return m_bIsSystemGenerated; }
            set { m_bIsSystemGenerated = value; }
        }
        /// <summary>
        /// Used to store IsSoftLocked
        /// </summary>
        public Boolean IsSoftLocked
        {
            get { return m_bIsSoftLocked; }
            set { m_bIsSoftLocked = value; }
        }
        /// <summary>
        /// Used to store SoftLockedBy
        /// </summary>
        public int SoftLockedBy
        {
            get { return m_nSoftLockedBy; }
            set { m_nSoftLockedBy = value; }
        }
        /// <summary>
        /// Used to store SoftLockTimestamp
        /// </summary>
        public DateTime? SoftLockTimestamp
        {
            get { return m_dtSoftLockTimestamp; }
            set { m_dtSoftLockTimestamp = value; }
        }
        /// <summary>
        /// Used to store IsHardLocked
        /// </summary>
        public Boolean IsHardLocked
        {
            get { return m_bIsHardLocked; }
            set { m_bIsHardLocked = value; }
        }
        /// <summary>
        /// Used to store HardLockedBy
        /// </summary>
        public int HardLockedBy
        {
            get { return m_nHardLockedBy; }
            set { m_nHardLockedBy = value; }
        }
        /// <summary>
        /// Used to store HardLockTimestamp
        /// </summary>
        public DateTime? HardLockTimestamp
        {
            get { return m_dtHardLockTimestamp; }
            set { m_dtHardLockTimestamp = value; }
        }
        /// <summary>
        /// Used to store CreateTimestamp
        /// </summary>
        // Display name of this property
        [DisplayName("Created On")]
        public DateTime? CreateTimestamp
        {
            get { return m_dtCreateTimestamp; }
            set { m_dtCreateTimestamp = value; }
        }
        /// <summary>
        /// Used to store CreatedBy
        /// </summary>
        public int CreatedBy
        {
            get { return m_nCreatedBy; }
            set { m_nCreatedBy = value; }
        }
        /// <summary>
        /// Used to store ModifiedTimestamp
        /// </summary>
        // Display name of this property
        [DisplayName("Modified On")]
        public DateTime? ModifiedTimestamp
        {
            get { return m_dtModifiedTimestamp; }
            set { m_dtModifiedTimestamp = value; }
        }
        /// <summary>
        /// Used to store ModifiedBy
        /// </summary>
        public int ModifiedBy
        {
            get { return m_nModifiedBy; }
            set { m_nModifiedBy = value; }
        }
        /// <summary>
        /// Used to store DeleteFlag
        /// </summary>
        public Boolean DeleteFlag
        {
            get { return m_bDeleteFlag; }
            set { m_bDeleteFlag = value; }
        }
        /// <summary>
        /// Used to store PageNumber
        /// </summary>
        public int PageNumber
        {
            get { return m_nPageNumber; }
            set { m_nPageNumber = value; }
        }
        /// <summary>
        /// Used to store RowSize
        /// </summary>
        public int RowSize
        {
            get { return m_nRowSize; }
            set { m_nRowSize = value; }
        }
        /// <summary>
        /// Used to store SortOn
        /// </summary>
        public String SortOn
        {
            get { return m_strSortOn; }
            set { m_strSortOn = value; }
        }
        /// <summary>
        /// Used to store SortType
        /// </summary>
        public String SortType
        {
            get { return m_strSortType; }
            set { m_strSortType = value; }
        }
        /// <summary>
        /// Used to store Search
        /// </summary>
        public String Search
        {
            get { return m_strSearch; }
            set { m_strSearch = value; }
        }
        /// <summary>
        /// Used to store SearchOn
        /// </summary>
        public String SearchOn
        {
            get { return m_strSearchOn; }
            set { m_strSearchOn = value; }
        }


        /// <summary>
        /// Used to store Condition
        /// </summary>
        public Boolean Condition
        {
            get { return m_bCondition; }
            set { m_bCondition = value; }
        }
        /// <summary>
        /// Used to store UserIds
        /// </summary>
        public String UserIds
        {
            get { return m_strUserIds; }
            set { m_strUserIds = value; }
        }
        /// <summary>
        /// Used to store Password Change Purpose
        /// </summary>
        public int PasswordChangePurpose
        {
            get { return m_nPasswordChangePurpose; }
            set { m_nPasswordChangePurpose = value; }
        }
        /// <summary>
        /// Used to store username who owns the softlock.
        /// </summary>
        public string SoftLockedByName
        {
            get { return m_strSoftlockedByName; }
            set { m_strSoftlockedByName = value; }
        }
        /// <summary>
        /// Used to store username who owns the hardlock.
        /// </summary>
        public string HardLockedByName
        {
            get { return m_strHardlockedByName; }
            set { m_strHardlockedByName = value; }
        }
        /// <summary>
        /// Used to store CreatedBy Name
        /// </summary>
        // Display name of this property
        [DisplayName("Created By")]
        public string CreatedByName
        {

            get { return m_strCreatedByName; }
            set { m_strCreatedByName = value; }
        }
        /// <summary>
        /// Used to store ModifiedBy Name
        /// </summary>
        // Display name of this property
        [DisplayName("Modified By")]
        public string ModifiedByName
        {

            get { return m_strModifiedByName;}
            set { m_strModifiedByName = value; }
        }
    }
}